#!/bin/bash
PATH="/opt/java/jdk1.8.0_151/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
echo "======================to do truncate=========================="
cd docker-hive
echo "trucate in background"
docker-compose exec -d hive-server env LANG=C.UTF-8 bash -c '/opt/hive/bin/beeline -u jdbc:hive2://localhost:10000 -e "truncate table ods_wms.goods;"'
sleep 30
echo "======================to do extract=========================="

docker-compose kill
docker-compose up -d namenode

docker-compose up -d datanode

sleep 120

docker-compose ps

ip=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' docker-hive_namenode_1`
echo $ip
 /opt/datax/bin/datax.py --jvm="-Xms200M -Xmx200M" -p"-Dip=$ip" /opt/datax/job/imp_wms_goods.job

docker-compose ps
